<template>
    <div style="margin: 0px auto">
        <h1 align="center">管理员管理</h1>
        <span></span>
        <el-table
                :data="tableData"
                style="width: 100%"
                max-height="350">
            <el-table-column
                    fixed
                    prop="ID"
                    label="ID"
                    width="150">
            </el-table-column>
            <el-table-column
                    prop="nicknme"
                    label="昵称"
                    width="120">
            </el-table-column>
            <el-table-column
                    prop="job"
                    label="职位"
                    width="120">
            </el-table-column>
            <el-table-column
                    prop="storeid"
                    label="分店ID"
                    width="120">
            </el-table-column>
            <el-table-column
                    prop="phone"
                    label="手机"
                    width="300">
            </el-table-column>
            <el-table-column
                    fixed="right"
                    label="操作"
                    width="120">
                <template slot-scope="scope">
                    <el-button
                            @click.native.prevent="deleteRow(scope.$index, tableData)"
                            type="text"
                            size="small">
                        移除
                    </el-button>
                    <el-button
                            @click="dialogFormVisible=true"
                            type="text"
                            size="small">
                        添加
                    </el-button>

                    <el-button
                            @click="dialogFormVisible=true"
                            type="text"
                            size="small">
                        修改
                    </el-button>
                </template>
            </el-table-column>
        </el-table>
        <el-dialog title="管理员管理" :visible.sync="dialogFormVisible">
            <el-form :model="tableData" :rules="rules" ref="tableData" label-width="50px"
                     class="demo-ruleForm">
                <el-form-item label="昵称" prop="name">
                    <el-input v-model="tableData.name"></el-input>
                </el-form-item>
                <el-form-item label="职位" prop="province">
                    <el-input v-model="tableData.province"></el-input>
                </el-form-item>
                <el-form-item label="手机" prop="address">
                    <el-input v-model="tableData.address"></el-input>
                </el-form-item>
                <el-form-item style="margin-left: 100px;margin: 0px auto">
                    <el-button type="primary">修改</el-button>
                    <el-button @click="resetForm('tableData')">重置</el-button>
                </el-form-item>
            </el-form>
        </el-dialog>
    </div>
</template>

<script>
    export default {
        name: "deleteAdmin",
        //测试用的数据,可以删除
        data() {
            return {
                dialogFormVisible: false,
                tableData: [{
                    //id
                    ID: '2016-05-03',
                    //昵称
                    nicknme: '王小虎',
                    //职位
                    job: '上海',
                    //分店ID
                    storeid: '普陀区',
                    //电话
                    phone: '上海市普陀区金沙江路 1518 弄',
                }, {
                    //id
                    ID: '2016-05-03',
                    //昵称
                    nicknme: '王小虎',
                    //职位
                    job: '上海',
                    //分店ID
                    storeid: '普陀区',
                    //电话
                    phone: '上海市普陀区金沙江路 1518 弄',
                }, {
                    //id
                    ID: '2016-05-03',
                    //昵称
                    nicknme: '王小虎',
                    //职位
                    job: '上海',
                    //分店ID
                    storeid: '普陀区',
                    //电话
                    phone: '上海市普陀区金沙江路 1518 弄',
                }, {
                    //id
                    ID: '2016-05-03',
                    //昵称
                    nicknme: '王小虎',
                    //职位
                    job: '上海',
                    //分店ID
                    storeid: '普陀区',
                    //电话
                    phone: '上海市普陀区金沙江路 1518 弄',
                }, {
                    //id
                    ID: '2016-05-03',
                    //昵称
                    nicknme: '王小虎',
                    //职位
                    job: '上海',
                    //分店ID
                    storeid: '普陀区',
                    //电话
                    phone: '上海市普陀区金沙江路 1518 弄',
                }, {
                    //id
                    ID: '2016-05-03',
                    //昵称
                    nicknme: '王小虎',
                    //职位
                    job: '上海',
                    //分店ID
                    storeid: '普陀区',
                    //电话
                    phone: '上海市普陀区金沙江路 1518 弄',
                }, {
                    //id
                    ID: '2016-05-03',
                    //昵称
                    nicknme: '王小虎',
                    //职位
                    job: '上海',
                    //分店ID
                    storeid: '普陀区',
                    //电话
                    phone: '上海市普陀区金沙江路 1518 弄',
                }]
            }
        },
        //移除方法
        methods: {
            deleteRow(index, rows) {
                rows.splice(index, 1);
            },
            //重置方法
            resetForm(tableData) {
                this.$refs[tableData].resetFields();
            }
        }
    }
</script>

<style scoped>

</style>